import requests
import config

class DeptAPI:
    # 获取部门组织架构列表
    def get_dept_list(self,token):
        return requests.get(url=f"{config.BASE_URL}/api/company/department",headers={"Authorization":token})
    # 创建部门
    def insert_dept(self,insert_data,token):
        return requests.post(url=f"{config.BASE_URL}/api/company/department",json=insert_data,headers={"Authorization":token})
    # 查询部门
    def select_dept(self,dept_id,token):
        return requests.get(url=f"{config.BASE_URL}/api/company/department/{dept_id}",headers={"Authorization":token})
    # 修改部门
    def update_dept(self,dept_id,update_data,token):
        return requests.put(url=f"{config.BASE_URL}/api/company/department/{dept_id}",json=update_data,headers={"Authorization":token})
    # 删除部门
    def delete_dept(self,dept_id,token):
        return requests.delete(url=f"{config.BASE_URL}/api/company/department/{dept_id}",headers={"Authorization":token})
